class Solution {
public:
    bool lemonadeChange(vector<int>& bills) {
        int five = 0, ten = 0;
        for(int i = 0; i < bills.size(); ++i)
        {
            if(bills[i] == 5)
                ++five;
            else if(bills[i] == 10)
            {
                if(five == 0)
                    return false;
                --five;
                ++ten;
            }
            else // 20块，找15，先看有没有10
            {
                if(five != 0 && ten != 0) // 贪心
                    --five, --ten;
                else if(five >= 3)
                    five -= 3;
                else
                    return false;
            }
        }
        return true;
    }
};